<?php 
	session_start();
	$id_employee=$_SESSION['IDEmployee'];
	$id=$_GET['id'];
	include '../operations/connection.php';
	function getlang(){
		$lang = $_SESSION['lang'];
		
		if (empty($lang) || $lang == "EN") {
			$value = "../value/value_en.php";
		} else if($lang == "VN") {
			$value = "../value/value_vn.php";
		}
		else {
			$value = "../value/value_kr.php";
		}
		return $value;
	}
	$value = getlang();
	include($value);
	$lang = $_SESSION['lang'];
		//Get information of document
		
	$query = mysql_query("select a.Tile,a.Content,e.Fullname,a.Timecreate,a.comment,a.EmployeePerforment,a.Description, a.TotalTime,a.TripDate,a.Location,a.IDGroupApprove,a.IDStatus ,dl.DepartmentName,e.Position
							from approvedoc a , employee e ,department_lang dl
							where a.IDApproveDoc = '$id' AND a.IDEmployee = e.IDEmployee AND e.IDDepartment=dl.IDDepartment AND dl.LangID='$lang';");

		while ($row = mysql_fetch_array($query))
		{
			$dtitle = $row[Tile];
			$dcontent = $row[Content];
			$dtime = $row[Timecreate];
			$duser = $row[Fullname];
			$dcomment = $row[comment];
			$dperforment = $row[EmployeePerforment];
			$ddescription = $row[Description];
			$dtotalTime = $row[TotalTime];
			$dtripDate = $row[TripDate];
			$dlocation = $row[Location];
			$didgroupapprover = $row[IDGroupApprove];
			$dstatus = $row[IDStatus];
			$dsDepartmentName=$row[DepartmentName];
			$dsposition=$row[Position];
		}
		$query1 = mysql_query("SELECT l.IDStatus,l.DateApprove,e.Fullname,l.Description,l.IDEmployee ,dl.DepartmentName
								FROM listapprove l , employee e , department_lang dl
								WHERE l.IDGroupApprove = '$didgroupapprover' AND l.IDEmployee = e.IDEmployee  AND e.IDDepartment=dl.IDDepartment AND dl.LangID='$lang' ORDER BY l.Order ASC");
	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="style/style.css" rel="stylesheet" />
<title>Print</title>
</head>

<body onload="window.print();">
	
<div class="print_report">
    	<div style="float: left; width:350px"><span id="form-caption"><?=$l_assignment_report?></span>
   	  		<table style="border-collapse:collapse" class="padd">
            	<tr>
                	<th align="left" width="20%" valign="top"><?=$l_created_date?></th>
					<td align="left" width="30%" valign="top"><?=$dtime?></td>
                    <th align="left" width="20%" valign="top"><?=$l_department?></th>
					<td align="left" width="30%" valign="top"><?=$dsDepartmentName?></td>
        		</tr>
                <tr>
                	<th align="left" width="20%" valign="top"><?=$l_position?></th>
					<td align="left" width="30%" valign="top"><?=$dsposition?></td>
                    <th align="left" width="20%" valign="top"><?=$l_writer?></th>
					<td align="left" width="30%" valign="top"><?=$duser?></td>
                </tr>                
            </table>
        </div>
		<div class="rcontent">
        	<table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse; float:left">
            	<tr>
                	<td width="40px" valign="middle" align="left">
                    	<img src="images/approver_en.png" alt="" />
                    </td>
                    <td>
                    	<ul class="list-approver" <?php if( mysql_num_rows( $query1)>=3){?> style="width: 320px" <?php }?> >
                    		<?php while ($row = mysql_fetch_array($query1)){
                    				$dnameapprover = $row[Fullname];
                    				$dnamedepartment = $row[DepartmentName];
                    		?>
							<li>
                            	<span class="approver-title"><?=$dnamedepartment?></span>
                            	<span class="approver-name"><?=$dnameapprover?></span>
                            	<span class="approver-signature"></span>
                            </li>
                           <?php }?>
                      </ul>
                    </td>
                </tr>
            </table>
        </div>
        <br style="clear:both" />
        <br />
        <table class="padd" width="100%" cellspacing="0" cellpadding="0"> 
        	<tr>
            	<th class="top" colspan="4"></th>
            </tr>   
            <tr>
            	<th align="left"><?=$l_title?></th>
				<td colspan="3"><?=$dtitle?></td>
            </tr>
<tr>
            	<th align="left" width="15%"><?=$l_employee_performent?></th>				
		<td width="35%"><?=$dperforment?></td>
                <th align="left" width="15%"><?=$l_trip_date?></th>
              <td><?=$dtripDate?></td>
       	  </tr> 
            <tr>
            	<th align="left"><?=$l_location?></th>				
				<td><?=$dlocation?></td>
                <th align="left"><?=$l_total_time?></th>
              <td><?=$dtotalTime?></td>
        	</tr>    	
            <tr>
            	<th align="left"><?=$l_content?></th>
				<td colspan="3"><?=$dcontent?></td>
            </tr>
        	<tr>
                <th align="left"><?=$l_comment?></th>
                <td colspan="3"><?=$dcomment?></td>
            </tr>            
        </table>     
        
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top:16px">
            <tr>
            	<td align="left" width="50%">ELI_F_0740_05</td>
            	<td align="right" width="50%">ELISOFT.LD</td>
            </tr>
        </table>
    </div>
</body>
</html>
